package com.xinqi.modules.course.comment.service;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.base.response.R;
import com.xinqi.common.base.user.Account;
import com.xinqi.common.mybatis.data.service.BaseService;
import com.xinqi.modules.course.comment.domain.CommentEntity;
import com.xinqi.modules.course.comment.dto.req.*;
import com.xinqi.modules.course.comment.dto.rsp.CommentResultDTO;


import java.util.Map;

/**
 * 课程栏目评论表服务层
 *
 * @author: yyzhen
 * @date: 2023/03/20
 */
public interface CommentService extends BaseService<CommentEntity> {

    /**
     * 分页
     *
     * @Title:
     * @MethodName: page
     * [pageable, query]
     * @Return com.xinqi.common.base.response.PageInfo<com.xinqi.modules.sys.comment.dto.rsp.CommentResultDTO>
     * @Exception
     * @Description:
     * @author: yyzhen
     * @date: 2023/3/20 11:29
     */
    PageInfo<CommentResultDTO> page(Param pageable, CommentQueryDTO query);

    /**
     * 评论
     *
     * @Title:
     * @MethodName: insert
     * [dto]
     * @Return java.lang.Boolean
     * @Exception
     * @Description:
     * @author: yyzhen
     * @date: 2023/3/20 11:29
     */
    CommentResultDTO comment(CommentCreateDTO dto, Account user);

    /**
     * 回复评论
     *
     * @Title:
     * @MethodName: reply
     * [dto]
     * @Return java.lang.Boolean
     * @Exception
     * @Description:
     * @author: yyzhen
     * @date: 2023/3/20 11:29
     */
    CommentResultDTO reply(CommentReplyDTO dto, Account user);

    /**
     * 点赞 / 取消点赞
     *
     * @Title:
     * @MethodName: give
     * [dto]
     * @Return com.xinqi.common.base.response.R
     * @Exception
     * @Description:
     * @author: yyzhen
     * @date: 2023/3/26 17:02
     */
    R<Void> give(CommentGiveCreateDTO dto, Account user);


    /**
     * 删除评论
     *
     * @Title:
     * @MethodName: remove
     * [dto]
     * @Return java.lang.Boolean
     * @Exception
     * @Description:
     * @author: yyzhen
     * @date: 2023/3/20 11:29
     */
    Boolean remove(CommentDeleteDTO dto);

    /**
     * 获取当前的总评论数与总点赞数
     *
     * @Title:
     * @MethodName: selectCountByTypeAndContentId
     * [type, contentId, times]
     * @Return java.util.Map<java.lang.String, java.lang.Integer>
     * @Exception
     * @Description:
     * @author: yyzhen
     * @date: 2023/4/24 21:23
     */
    Map<String, Integer> selectCountByTypeAndContentId(Integer type, Long contentId, Integer times);
}
